<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Document</title>
  </head>
  <body>
    <span>hhhhhgggbdb</span>
    <script>
      //防抖
      function debouncce(fn,wait){
        let timer = null
        return function(){
          if(timer) clearTimeout(timer)
          timer = setTimeout(function(){
            fn()
          },wait)
        }
      }

      //节流
      function save(fn,wait){
        let timer = null
       return function(){
         if(!timer){
           fn()
           timer = setTimeout(function(){
            timer = null
           },wait)
         }
       }
      }
    </script>
  </body>
</html>
